<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=8">
<meta http-equiv="Expires" content="0">
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="Cache-control" content="no-cache">
<meta http-equiv="Cache" content="no-cache">
    <meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <title>众筹活动列表</title>
    <script src="javascript/jquery.min.js"></script>
    <script src="javascript/function.js"></script>
    <link rel="stylesheet" href="stylesheet/style_v1.1.css">
</head>
<body style="background-color: #f6f6f6">
<div class="header-title">
    <a href="javascript:void(0);" class="fanhui">
        <img src="image/tick.png" alt="">
    </a>
    <p>众筹活动列表</p>
</div>
<div class="con padding-top50 padding-bottom50 padding-lr5" id="activityListShow">
</div>
     <%@ include file="footer.jsp"%>
<script>
$(function () {
	queryActivityList();
});
function queryActivityList() {
//		var params = "parms.productTypeId=" + typeId;
	$.ajax({
				type : 'post',
				url : 'cliffordAction!queryActivityList.action',
				async : false,
//					data : params, // 传给action的参数
				success : function(data) {
					if (data.result == 1) {
						if (data.resultData.size == '0') {
							document.getElementById("activityListShow").innerHTML="";
							alert("未获取到活动信息");
						} else {
							var list = data.resultData.datalist;
							var html = "";
							for ( var i = 0; i < list.length; i++) {
								html += '  <a href="forwardPageParam_activityDetail.action?parms.activityId='+list[i].zjfGoodsActivity.activityId+'" class="zc-list">';
								  html += '   <p class="zc-name">'+list[i].zjfGoodsActivity.activityName+'</p>';
							        html += '    <p class="zc-title">'+list[i].zjfGoodsActivity.activityName+'</p>';
							        html += '    <img src="'+list[i].zjfGoodsActivity.activityImg+'" alt="">';
							        html += '    <div class="zc-info">';
							        html += '        <p class="zc-zje">筹集金额￥<span>'+list[i].zjfGoodsActivityRecord.total+'</span>元</p>';
							            html += '        <hr>';
							            html += '     <ul class="zc-sj">';
							            html += '        <li>';
							                html += '           <p>支持人数</p>';
							                    html += '           <span>'+list[i].zjfGoodsActivityRecord.personcount+'</span>';
							                    html += '     </li>';
							                html += '    <li>';
							                html += ' <p>当前折扣</p>';
							                    html += ' <span>'+list[i].zjfGoodsActivity.discount+'</span>';
							                    html += '</li>';
							                html += '  <li>';
							                html += ' <p>剩余天数</p>';
							                    html += '  <span>'+changeDte(list[i].zjfGoodsActivity.activityEndTime)+'天</span>';
							                    html += ' </li>';
							                html += ' </ul>';
							            html += '  <div class="zc-jd">';
							            html += '   <span class="jdt"></span>';
							                html += '  </div>';
							            html += ' <div class="zc-jianjie">';
							            html +='<p>'+list[i].zjfGoodsActivity.activityContent+'</p>';
							                html += ' </div>';
							            html += ' </div>';
							        html += ' </a>';
							}
							document.getElementById("activityListShow").innerHTML = html;
						}
					} else {
						document.getElementById("activityListShow").innerHTML="";
						alert(data.msg);
					}
				}
			});
}
function changeDte(endDate){
	var date = new Date();
	var nowToday  = date.getFullYear() + "-" + (date.getMonth()+1) + "-" + date.getDate();
	return DateDiff(nowToday,endDate);
}    
</script>
</body>
</html>